|
The byte order mark (BOM) is a Unicode character, , whose appearance as a magic number at the start of a text stream can signal several things to a program consuming the text:〔(Unicode FAQ: UTF-8, UTF-16, UTF-32 & BOM )〕 *What byte order, or endianness, the text stream is stored in; *The fact that the text stream is Unicode, to a high level of confidence; *Which of several Unicode encodings that text stream is encoded as. BOM use is optional, and, if used, should appear at the start of the text stream. Unicode can be encoded as 8-bit, 16-bit, or 32-bit integers. For the 16- and 32-bit representations, a computer receiving text from arbitrary sources needs to know which byte order the integers are encoded in. Because the BOM itself is encoded in the same scheme as the rest of the document, but has a known value, the consumer of the text can examine these first few bytes to determine the encoding. The BOM thus gives the producer of the text a way to describe the text stream's endianness to the consumer of the text without requiring some contract or metadata outside of the text stream itself. Once the receiving computer has consumed the text stream, it is free to process the characters in its own native byte order and no longer needs the BOM. Hence the need for a BOM arises in the context of text interchange, rather than in text processing within a closed environment. ==Usage== If the BOM character appears in the middle of a data stream, Unicode says it should be interpreted as a "zero-width non-breaking space" (inhibits line-breaking between word-glyphs). In Unicode 3.2, this usage is deprecated in favour of the "Word Joiner" character, U+2060.〔 This allows U+FEFF to be only used as a BOM. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「byte order mark」の詳細全文を読む スポンサード リンク
|